package com.yanqu.road.server.cmd.activity.unionwar;

import com.yanqu.road.pb.activity.unionwar.UnionWarActivityServerProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWar;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_UNION_WAR_SYNC_GUESS, desc = "群英争霸同步竞猜数据")
public class UnionWarGuessSyncCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        UnionWarActivityServerProto.UnionWarGuessSyncMsg syncMsg = UnionWarActivityServerProto.UnionWarGuessSyncMsg.parseFrom(packet.getBytes());
        UnionWar unionWar = UnionPhaseWarMgr.getUnionWar(syncMsg.getActivityId());
        if (unionWar != null) {
            unionWar.guessUnionInfoSync(syncMsg);
        }
    }
}
